home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cmln1085.arc
/
GSXINPUT.INC
< prev
next >
Wrap
Text File
|
1986-02-27
|
7KB
|
151 lines
{ --- input functions. Include file GSXINPUT.INC --- }
{*************************************************************************}
procedure setinputmode( input, {in: input device requested:
1 = locator 2 = valuator
3 = choice 4 = string }
mode : integer; {in : requested mode:
1 = request 2 = sample }
var realizedmode : integer {out: mode realized by the device}
); { 0= device not supported}
{*************************************************************************}
var contrl : array[1..5] of integer;
intin : array[1..2] of integer;
ptsin, intout, ptsout : integer;
begin contrl[1] := 33;
contrl[2] := 0;
contrl[4] := 2;
intin[1] := input;
intin[2] := mode;
setpblock( addr(contrl), addr(intin ),
addr(ptsin ), addr(intout),
addr(ptsout));
callgdos( addr(pb));
realizedmode :=intout {0 indicates device not supported }
end;
{**********************************************************************}
function inputlocator( device, {in: device number for input}
mode, {in: 1=request 2=sample}
x, y : integer; {in: initial coords of locator
(request mode only,
ignored if sample mode)}
var finalx, finaly: integer; {out: final coords of locator}
var terminator : char {out: terminator character }
): integer; {out: 0 = not successful
>0= successful }
{**********************************************************************}
var contrl : array[1..5] of integer;
ptsin, ptsout : array[1..2] of integer;
intin, intout : integer;
begin contrl[1] := 28;
if mode = 2 then contrl[2] := 0 else contrl[2] := 1;
contrl[4] := 1;
intin := device;
if contrl[2] = 1 then begin
ptsin[1] := x;
ptsin[2] := y
end {if};
setpblock( addr(contrl), addr(intin ),
addr(ptsin ), addr(intout),
addr(ptsout));
callgdos( addr(pb));
inputlocator := contrl[5];
finalx := ptsout[1];
finaly := ptsout[2];
terminator := chr(intout)
end;
{***********************************************************************}
function inputvaluator( device, {in: device no. for input}
mode, {in: 1=request 2=sample}
invalue : integer; {in: initial NDC value
request mode only, ignored
in sample mode}
var outvalue : integer {out: NDC output value returned}
): integer; {out: 0=successful
>1=unsuccessful}
{***********************************************************************}
var contrl : array[1..5] of integer;
intin : array[1..2] of integer;
ptsin, intout, ptsout : integer;
begin contrl[1] := 29;
contrl[2] := 0;
if mode = 2 then contrl[4]:=1 else contrl[4] := 2;
intin[1] := device;
if contrl[4] = 2 then intin[2] := invalue;
setpblock( addr(contrl), addr(intin ),
addr(ptsin ), addr(intout),
addr(ptsout));
callgdos( addr(pb));
inputvaluator := contrl[5];
outvalue := intout
end;
{**************************************************************************}
function inputchoice( device, {in: 1=default, 2=function key,
>2 = workstation dependent}
mode, {in: 1=request, 2=sample}
inchoice : integer; {in: initial choice requested,
request mode only, ignored if
sample mode}
var choice : integer {out: choice device number if
successful}
): integer; {out: 0 = request unsuccessful
>1 = request successful}
{**************************************************************************}
var contrl : array[1..5] of integer;
intin : array[1..2] of integer;
intout, ptsin, ptsout : integer;
begin contrl[1] := 30;
contrl[2] := 0;
if mode = 2 then contrl[4] := 1 else contrl[4]:= 2;
intin[1] := device;
if contrl[4] = 2 then intin[2] := inchoice;
setpblock( addr(contrl), addr(intin ),
addr(ptsin ), addr(intout),
addr(ptsout));
callgdos( addr(pb));
choice := contrl[5];
inputchoice := intout
end;
{************************************************************************}
function inputstring( device, {in: 1=default device (keybd)
>1=workstation dependent}
echo : integer; {in: 1=echo chars on screen
0=inhibit screen echo}
var len : integer {out: actual length of requested
string}
): string255; {out: returned string <= 255 chars}
{************************************************************************}
{ operates in either sample or request mode}
var contrl : array[1..5] of integer;
intin : array[1..3] of integer;
intout : array[1..255] of integer;
ptsin, ptsout : integer;
i : byte;
st : string255;
begin contrl[1] := 31;
contrl[2] := 0;
contrl[4] := 3;
intin[1] := device;
intin[2] := 255;
intin[3] := echo;
setpblock( addr(contrl), addr(intin ),
addr(ptsin ), addr(intout),
addr(ptsout));
callgdos( addr(pb));
len := contrl[5];
st := '';
if (len > 0) and (len <= 255) then for i := 1 to len do
st := st + chr(intout[i]);
inputstring := st
end;